home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / earcd / misc / emu / arosdev.lha / AROS / makefile < prev    next >
Makefile  |  1997-02-07  |  10KB  |  328 lines

  1. # $Id: makefile,v 1.58 1997/02/07 14:21:55 digulla Exp $
  2.  
  3. # BEGIN_DESC{makefile}
  4. # This is the toplevel makefile. Use it if you want to compile the whole
  5. # distribution.
  6. # END_DESC{makefile}
  7.  
  8. # BEGIN_DESC{makevar}
  9. # \item{TOP} contains is the complete path to the root directory of the
  10. #    project.
  11. #
  12. # \item{CURDIR} is the path from $(TOP) to the current directory.
  13. #
  14. # END_DESC{makevar}
  15. TOP=.
  16. CURDIR=.
  17.  
  18. # BEGIN_DESC{localmakevar}
  19. # END_DESC{localmakevar}
  20. SPECIAL_CFLAGS = -Dmain=submain
  21.  
  22. include $(TOP)/config/make.cfg
  23.  
  24. # BEGIN_DESC{localmakevar}
  25. # \item{LIBS} Flags which are passed to the linker for executables.
  26. #
  27. # \item{DEP_LIBS} Files on which executables depend (ie. if these files are
  28. #    newer than the executable, then the executable is linked anew).
  29. #
  30. # END_DESC{localmakevar}
  31. ifeq ("$(SHARED_AR)","")
  32. LIBAMIGAOS = $(LIBDIR)/libAmigaOS.a
  33. else
  34. LIBAMIGAOS = $(LIBDIR)/libAmigaOS.so
  35. endif
  36.  
  37. DEP_LIBS= $(LIBAMIGAOS) \
  38.     $(GENDIR)/filesys/emul_handler.o \
  39.     $(LIBDIR)/libaros.a
  40.  
  41. LIBS=-L$(LIBDIR) \
  42.     $(GENDIR)/filesys/emul_handler.o -lAmigaOS -laros
  43.  
  44. # BEGIN_DESC{localmakevar}
  45. # \item{SUBDIRS} Contains the names of directories in which Make will recurse
  46. #    for the main targets (eg. all, clean).
  47. #
  48. # END_DESC{localmakevar}
  49. SUBDIRS = config compiler rom workbench apps
  50.  
  51. # BEGIN_DESC{localmakevar}
  52. # \item{TESTDIR} The director in which the test cases will be put in
  53. #
  54. # \item{TESTS} Names of the files of the test cases
  55. #
  56. # END_DESC{localmakevar}
  57. TESTDIR = $(BINDIR)/test
  58. TESTS = $(TESTDIR)/tasktest \
  59.     $(TESTDIR)/signaltest \
  60.     $(TESTDIR)/exceptiontest \
  61.     $(TESTDIR)/tasktest2 \
  62.     $(TESTDIR)/messagetest \
  63.     $(TESTDIR)/semaphoretest \
  64.     $(TESTDIR)/initstructtest \
  65.     $(TESTDIR)/devicetest \
  66.     $(TESTDIR)/filetest
  67.  
  68. # BEGIN_DESC{target}
  69. # \item{all} Compile the whole project (except the documentation).
  70. #
  71. # END_DESC{target}
  72. ifeq ($(FLAVOUR),native)
  73. all: setup subdirs
  74. else
  75. all : setup subdirs AmigaOS $(BINDIR)/arosshell
  76. endif
  77.  
  78. # BEGIN_DESC{target}
  79. # \item{crypt} Create the file crypt to create a password for CVS access
  80. #
  81. # END_DESC{target}
  82. crypt : crypt.c
  83.     $(CC) -o crypt crypt.c
  84.  
  85. # BEGIN_DESC{localmakevar}
  86. # \item{BINARCHIVE} Basename of the binary archive
  87. #
  88. # \item{DEVARCHIVE} Basename of the source archive
  89. #
  90. # END_DESC{localmakevar}
  91. BINARCHIVE = AROS-$(ARCH)-$(KERNEL)-$(VERSION)
  92. DEVARCHIVE = AROSdev-$(VERSION)
  93.  
  94. # BEGIN_DESC{target}
  95. # \item{dist} Create the distribution archives
  96. #
  97. # END_DESC{target}
  98. # BEGIN_DESC{internaltarget}
  99. # \item{dir-dir} Creates the directory for the distribution archives
  100. #
  101. # \item{dist-tar} Create .tar.gz archive of the binary for the local
  102. #    architecture.
  103. #
  104. # \item{dist-lha} Create LhA archive of the binary for the local
  105. #    architecture.
  106. #
  107. # \item{dist-src} Create the source archive as .tar.gz and LhA files.
  108. #
  109. # END_DESC{internaltarget}
  110. dist : dist-dir dist-tar dist-lha dist-src
  111.     cp README dist/$(BINARCHIVE).readme
  112.     cp README dist/$(DEVARCHIVE).readme
  113.  
  114. dist-dir : .FORCE
  115.     @if [ ! -d dist ]; then $(MKDIR) dist ; else true ; fi
  116.     @echo "Correcting access flags"
  117.     @chmod -R ug=rwX,o=rX .
  118.  
  119. dist-tar : .FORCE
  120.     cd $(ARCHDIR) ; \
  121.         $(RM) ../../dist/$(BINARCHIVE).tgz ; \
  122.         tar chvvzf ../../dist/$(BINARCHIVE).tgz AROS
  123.  
  124. dist-lha : .FORCE
  125.     cd $(ARCHDIR) ; \
  126.         $(RM) ../../dist/$(BINARCHIVE).lha ; \
  127.         lha a ../../dist/$(BINARCHIVE).lha AROS
  128.  
  129. dist-src : .FORCE
  130.     $(TOP)/scripts/makedist src $(DEVARCHIVE)
  131.  
  132. # BEGIN_DESC{internaltarget}
  133. # \item{.FORCE} Alwaye remake rules that depend on this one
  134. #
  135. # END_DESC{internaltarget}
  136. .FORCE :
  137.  
  138. # BEGIN_DESC{internaltarget}
  139. # \item{setup} Check the setup and create all directories and files which
  140. #    are initially neccessary to compile AROS.
  141. #
  142. # END_DESC{internaltarget}
  143. setup :
  144.     @if [ ! -d amiga/include ]; then \
  145.         echo "Missing AmigaOS includes. Please get a copy and put" ; \
  146.         echo "them into amiga/include." ; \
  147.         exit 10 ; \
  148.     else true ; fi
  149.     @if [ ! -d bin ]; then $(MKDIR) bin ; else true ; fi
  150.     @if [ ! -d $(ARCHDIR) ]; then $(MKDIR) $(ARCHDIR) ; else true ; fi
  151.     @if [ ! -d $(BINDIR) ]; then $(MKDIR) $(BINDIR) ; else true ; fi
  152.     @if [ ! -d $(SDIR) ]; then $(MKDIR) $(SDIR) ; else true ; fi
  153.     @if [ ! -d $(EXEDIR) ]; then $(MKDIR) $(EXEDIR) ; else true ; fi
  154.     @if [ ! -d $(LIBDIR) ]; then $(MKDIR) $(LIBDIR) ; else true ; fi
  155.     @if [ ! -d $(DEVSDIR) ]; then $(MKDIR) $(DEVSDIR) ; else true ; fi
  156.     @if [ ! -d $(SLIBDIR) ]; then $(MKDIR) $(SLIBDIR) ; else true ; fi
  157.     @if [ ! -d $(TESTDIR) ]; then $(MKDIR) $(TESTDIR) ; else true ; fi
  158.     @if [ ! -d $(OSMODDIR) ]; then $(MKDIR) $(OSMODDIR) ; else true ; fi
  159.     @if [ ! -d $(GENDIR) ]; then $(MKDIR) $(GENDIR) ; else true ; fi
  160.     @if [ ! -d $(GENDIR)/test ]; then $(MKDIR) $(GENDIR)/test ; else true ; fi
  161.     @if [ ! -d $(GENDIR)/filesys ]; then $(MKDIR) $(GENDIR)/filesys ; else true ; fi
  162.     @$(MAKE) $(MFLAGS) subdirs TARGET=setup
  163.  
  164. # BEGIN_DESC{target}
  165. # \item{check} Run tests to check if AROS runs ok on your system.
  166. #
  167. # END_DESC{target}
  168. check : $(TESTS)
  169.     @for test in $(TESTS) ; do \
  170.         echo "Running test `basename $$test`" ; $$test ; \
  171.     done
  172.  
  173. # BEGIN_DESC{target}
  174. # \item{clean} Remove all generated files
  175. #
  176. # END_DESC{target}
  177. clean:
  178.     -$(RM) $(ARCHDIR)
  179.     $(MAKE) $(MFLAGS) subdirs TARGET=clean
  180.  
  181. # BEGIN_DESC{internaltarget}
  182. # \item{$(BINDIR)/arosshell} Create the AROS shell for systems which
  183. #    support emulation.
  184. #
  185. # END_DESC{internaltarget}
  186. $(BINDIR)/arosshell: $(GENDIR)/arosshell.o $(DEP_LIBS)
  187.     $(CC) $(CFLAGS) $< $(LIBS) $(GUI_LDFLAGS) $(GUI_LIBFLAGS) -o $@
  188.  
  189. # BEGIN_DESC{internaltarget}
  190. # \item{subdirs} Pass global targets to all subdirectories.
  191. #
  192. # END_DESC{internaltarget}
  193. subdirs:
  194.     @for dir in $(SUBDIRS) ; do \
  195.         echo "Making $(TARGET) in $$dir..." ; \
  196.         if ( cd $$dir ; \
  197.         $(MAKE) $(MFLAGS) TOP=".." CURDIR="$(CURDIR)/$$dir" \
  198.         TARGET=$(TARGET) $(TARGET) ) ; \
  199.         then true ; else exit 1 ; fi ; \
  200.     done
  201.  
  202. # BEGIN_DESC{internaltarget}
  203. # \item{AmigaOS} I have to restart make here since not all files might be
  204. #    existing in $(OSGENDIR) at the time when make was started in the
  205. #    first place.
  206. #
  207. # END_DESC{internaltarget}
  208. AmigaOS :
  209.     @$(MAKE) $(MFLAGS) $(LIBAMIGAOS)
  210.  
  211. # BEGIN_DESC{internaltarget}
  212. # \item{$(LIBDIR)/libAmigaOS.a} Recreate the kernel if any kernel function
  213. #    has been recompiled.
  214. #
  215. # END_DESC{internaltarget}
  216. $(LIBAMIGAOS) : $(wildcard $(OSGENDIR)/*.o) \
  217.         $(wildcard $(GENDIR)/alib/*.o)
  218.     @echo "Recreating library"
  219. ifeq ("$(SHARED_AR)","")
  220.     @$(AR) $@ $?
  221.     $(RANLIB) $@
  222. else
  223.     @$(SHARED_AR) $@ $^
  224. endif
  225.  
  226. CLIBDIR=$(TOP)/compiler/include/clib
  227. DEFINEDIR=$(TOP)/compiler/include/defines
  228.  
  229. includes: \
  230.         $(CLIBDIR)/exec_protos.h \
  231.         $(CLIBDIR)/dos_protos.h \
  232.         $(CLIBDIR)/utility_protos.h \
  233.         $(CLIBDIR)/graphics_protos.h \
  234.         $(CLIBDIR)/intuition_protos.h \
  235.         $(CLIBDIR)/console_protos.h \
  236.         $(CLIBDIR)/icon_protos.h \
  237.         $(CLIBDIR)/iffparse_protos.h
  238.  
  239. $(CLIBDIR)/exec_protos.h: $(wildcard config/$(KERNEL)/*.s \
  240.         config/$(KERNEL)/*.c rom/exec/*.c) scripts/genprotos.h
  241.     gawk -f scripts/genprotos.h --assign lib=Exec \
  242.     config/$(KERNEL)/*.s config/$(KERNEL)/*.c rom/exec/*.c
  243.     @$(TOP)/scripts/moveifchanged $@.new $@
  244.     @name=`basename $@ _protos.h` ; \
  245.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  246.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  247.  
  248. $(CLIBDIR)/dos_protos.h: $(wildcard rom/dos/*.c) scripts/genprotos.h
  249.     gawk -f scripts/genprotos.h --assign lib=Dos \
  250.     rom/dos/*.c
  251.     @$(TOP)/scripts/moveifchanged $@.new $@
  252.     @name=`basename $@ _protos.h` ; \
  253.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  254.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  255.  
  256. $(CLIBDIR)/utility_protos.h: $(wildcard rom/utility/*.c) scripts/genprotos.h
  257.     gawk -f scripts/genprotos.h --assign lib=Utility \
  258.     rom/utility/*.c
  259.     @$(TOP)/scripts/moveifchanged $@.new $@
  260.     @name=`basename $@ _protos.h` ; \
  261.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  262.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  263.  
  264. $(CLIBDIR)/graphics_protos.h: $(wildcard rom/graphics/*.c) scripts/genprotos.h
  265.     gawk -f scripts/genprotos.h --assign lib=Graphics \
  266.     rom/graphics/*.c
  267.     @$(TOP)/scripts/moveifchanged $@.new $@
  268.     @name=`basename $@ _protos.h` ; \
  269.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  270.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  271.  
  272. $(CLIBDIR)/intuition_protos.h: $(wildcard rom/intuition/*.c) scripts/genprotos.h
  273.     gawk -f scripts/genprotos.h --assign lib=Intuition \
  274.     rom/intuition/*.c
  275.     @$(TOP)/scripts/moveifchanged $@.new $@
  276.     @name=`basename $@ _protos.h` ; \
  277.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  278.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  279.  
  280. $(CLIBDIR)/console_protos.h: rom/devs/cdinputhandler.c \
  281.         rom/devs/rawkeyconvert.c scripts/genprotos.h
  282.     gawk -f scripts/genprotos.h --assign lib=Console \
  283.     rom/devs/cdinputhandler.c rom/devs/rawkeyconvert.c
  284.     @$(TOP)/scripts/moveifchanged $@.new $@
  285.     @name=`basename $@ _protos.h` ; \
  286.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  287.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  288.  
  289. $(CLIBDIR)/icon_protos.h: $(wildcard workbench/libs/icon/*.c) scripts/genprotos.h
  290.     gawk -f scripts/genprotos.h --assign lib=Icon \
  291.     workbench/libs/icon/*.c
  292.     @$(TOP)/scripts/moveifchanged $@.new $@
  293.     @name=`basename $@ _protos.h` ; \
  294.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  295.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  296.  
  297. $(CLIBDIR)/iffparse_protos.h: $(wildcard workbench/libs/iffparse/*.c) scripts/genprotos.h
  298.     gawk -f scripts/genprotos.h --assign lib=IFFParse \
  299.     workbench/libs/iffparse/*.c
  300.     @$(TOP)/scripts/moveifchanged $@.new $@
  301.     @name=`basename $@ _protos.h` ; \
  302.         $(TOP)/scripts/moveifchanged $(DEFINEDIR)/$$name.h.new $(DEFINEDIR)/$$name.h ; \
  303.         $(RM) $@.new $(DEFINEDIR)/$$name.h.new
  304.  
  305. $(GENDIR)/%.o: %.c
  306.     $(CC) $(CFLAGS) $< -c -o $@
  307.  
  308. #$(GENDIR)/%.d: %.c
  309. #     @$(RM) $@
  310. #     @touch $@
  311. #     @$(MKDEPEND) -f$@ -p$(GENDIR)/ -- $(CFLAGS) -- $^
  312. #
  313. #include $(GENDIR)/arosshell.d
  314.  
  315. # BEGIN_DESC{target}
  316. # \item{cleandep} Remove all generated dependency files.
  317. #
  318. # END_DESC{target}
  319. cleandep:
  320.     find $(GENDIR) -name "*.d" -exec $(RM) "{}" \;
  321.  
  322. # BEGIN_DESC{target}
  323. # \item{docs} Compile the documentation for AROS.
  324. #
  325. # END_DESC{target}
  326. docs: .FORCE
  327.     cd $(TOP)/docs/src ; make
  328.